Skip to content

Conversation

@filipsajdak
Copy link
Contributor

Close #117

The current implementation is not handling the parsing of a string literal. When the string has no matching " sign the cppfront parse the string infinitely.

Example of problematic file:

P:"P

This fix adds a check if cppfront is on the end of the line and returns:

tests/smallest_example.cpp2...
smallest_example.cpp2(1,2): error: string literal "Px00" is missing its closing "
smallest_example.cpp2(1,3): error: a deduced type must have an = initializer (at '"Px00')
smallest_example.cpp2(1,1): error: unexpected text at end of Cpp2 code section (at 'P')
smallest_example.cpp2(1,0): error: parse failed for section starting here

@filipsajdak filipsajdak force-pushed the fsajdak-fix-infinite-paring-of-string-literal-on-eol branch from 132c613 to 79c7b57 Compare November 29, 2022 21:11
@hsutter hsutter merged commit 30ec697 into hsutter:main Dec 2, 2022
@hsutter
Copy link
Owner

hsutter commented Dec 2, 2022

Looks good, thanks!

@filipsajdak filipsajdak deleted the fsajdak-fix-infinite-paring-of-string-literal-on-eol branch January 12, 2023 21:22
Azmah-Bad pushed a commit to Azmah-Bad/cppfront that referenced this pull request Feb 24, 2023
…paring-of-string-literal-on-eol

[FIX] Fix infinite loop while parsing of string literal when there is missing closing `"` character
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Infinite loop with malformed input

2 participants